{include file="public/header" /}
<style>
    .layui-input-block{width: 50%}
    #exportUser{
        cursor: pointer;
        display: block;
        color: red;
    }
    
  .layui-form-radio>.lay-skin-tag,
  .layui-form-checkbox>.lay-skin-tag{
    font-size: 13px;
    border-radius: 5px;
    height: 25px;
    line-height: 25px;
    margin-top: 7px;
    margin-right: 10px;
    color: #fff !important;
    background: #d2d2d2 !important;
  }
  .layui-form-checked>.lay-skin-tag,
  .layui-form-radioed>.lay-skin-tag {
    background-color: #16b777 !important;
  }
</style>
<body>
<div class="x-body">
    <form action="{:url('save')}" class="layui-form" id="form">
        <div class="layui-form-item">
            <label class="layui-form-label">手机号 </label>
            <div class="layui-input-inline">
                <input type="text" name="mobile" id="mobile" lay-verify="required" placeholder="请填写手机号"
                       lay-reqtext="请填写手机号" class="layui-input" lay-verType="tips" autocomplete="off"/>
            </div>
            <div class="layui-form-mid layui-word-aux"><a id="exportUser">导入报名信息</a></div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">登录密码 </label>
            <div class="layui-input-inline">
                <input type="password" name="password" lay-verify="required" value="111111" placeholder="请填写登录密码"
                       lay-reqtext="请填写登录密码" class="layui-input" lay-verType="tips"/>
            </div>
            <div class="layui-form-mid layui-word-aux">*默认为111111</div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">姓名 </label>
            <div class="layui-input-block">
                <input type="text" name="rname" id="rname" lay-verify="required" placeholder="请填写姓名"
                       lay-reqtext="请填写姓名" class="layui-input" lay-verType="tips"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input type="radio" name="sex" value="1" lay-verify="required" id="sex_1" lay-skin="none"  title="男 ♂">
                <div lay-radio class="lay-skin-tag layui-badge">男 ♂</div>
                <input type="radio" name="sex" value="2" lay-verify="required" id="sex_2" lay-skin="none"  title="女 ♀">
                <div lay-radio class="lay-skin-tag layui-badge">女 ♀</div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">年龄 </label>
            <div class="layui-input-block">
                <input type="number" name="age" id="age" lay-verify="required" placeholder="请填写年龄"
                       lay-reqtext="请填写年龄" class="layui-input" lay-verType="tips"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">出生日期</label>
            <div class="layui-input-block">
                <input type="text" name="birth" id="birth" readonly lay-verify="required" placeholder="yyyy-MM-dd"
                       lay-reqtext="请填写出生日期" class="layui-input" lay-verType="tips"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证号</label>
            <div class="layui-input-block">
                <input type="text" name="id_card" id="id_card" lay-verify="required" placeholder="请填写身份证号"
                       lay-reqtext="请填写身份证号" class="layui-input" lay-verType="tips"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">课程类型</label>
            <div class="layui-input-block" id="catelist">
                {volist name="cate" id="vo"}
                <input type="radio" name="cate" value="{$vo.id}" id="cate_{$vo.id}" lay-skin="none"  title="{$vo.title}" >
                <div lay-radio class="lay-skin-tag layui-badge">{$vo.title}</div>
                {/volist}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">工作经历</label>
            <div class="layui-input-block">
                <textarea name="content" id="content" placeholder="请填写工作经历" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <button class="layui-btn" lay-filter="save" lay-submit formObj="#form">
                保存
            </button>
        </div>
        
    </form>
</div>
</body>
{include file="public/footer" /}
{include file="public/qiniuToken" /}
<script>
    $("#exportUser").click(function () {
        var exportUser = layer.open({
            type: 2,
            title: '报名信息',
            shadeClose: true,
            shade: 0.8,
            area: ['90%', '90%'],
            content: '{:url("signup/index")}?exportUser=1'
        });
    })
    layui.use(['layer', 'form','laydate'], function(){
        var layer = layui.layer
        ,form = layui.form
        ,laydate = layui.laydate;
        laydate.render({
            elem: '#birth' //指定元素
        });
        // 父页面接收值的函数
        window.receiveValue = function(value) {
            $("#rname").val(value.rname);
            $("#mobile").val(value.tel);
            $("#age").val(value.age);
            $("#content").val(value.content);
            $("#id_card").val(value.id_card);
            $("#birth").val(value.birth);
            // $("#catelist input[type='checkbox']").prop("checked",false);
            // $("#catelist input[type='checkbox']").each(function(){
            //     var val = $(this).val();
            //     if(value.cate_id == val){
            //         $(this).prop("checked",true);
            //     }
            // });
            $("#sex_"+value.sex).prop("checked",true);
            $("#cate_"+value.cate_id).prop("checked",true);
            form.render('radio');
            // form.render('checkbox');
        }
    });
</script>
</html>